<html>
<head>

	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-8">

	<script type="text/javascript" src="webgl/init.js"></script>
	<script type="text/javascript" src="tools/sylvester.js"></script>
	<script type="text/javascript" src="tools/glUtils.js"></script>
	<script type="text/javascript" src="tools/transformation_tools.js"></script>
	<script type="text/javascript" src="tools/mouse.js"></script>
	<script type="text/javascript" src="parser/functions.js"></script>
	<script type="text/javascript" src="parser/part.js"></script>
	<script type="text/javascript" src="parser/joint.js"></script>
	<script type="text/javascript" src="parser/neuron.js"></script>
	<script type="text/javascript" src="parser/neuroninput.js"></script>
	<script type="text/javascript" src="parser/script.js"></script>
	
<script id="shader-fs" type="x-shader/x-fragment">
  #ifdef GL_ES
  precision highp float;
  #endif

  varying vec4 vColor;
  varying vec3 vLightWeighting;

  void main(void) {
    gl_FragColor = vec4(vColor.rgb * vLightWeighting, vColor.a);
  }
</script>

<script id="shader-vs" type="x-shader/x-vertex">
  attribute vec3 aVertexPosition;
  attribute vec3 aVertexNormal;
  attribute vec4 aVertexColor;

  uniform mat4 uMVMatrix;
  uniform mat4 uPMatrix;
  uniform mat4 uNMatrix;

  uniform vec3 uAmbientColor;

  uniform vec3 uLightingDirection;
  uniform vec3 uDirectionalColor;

  uniform bool uUseLighting;

  varying vec4 vColor;
  varying vec3 vLightWeighting;

  void main(void) {
    gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
    vColor = aVertexColor;

    if (!uUseLighting) {
      vLightWeighting = vec3(1.0, 1.0, 1.0);
    } else {
      vec4 transformedNormal = uNMatrix * vec4(aVertexNormal, 1.0);
      float directionalLightWeighting = max(dot(transformedNormal.xyz, uLightingDirection), 0.0);
      vLightWeighting = uAmbientColor + uDirectionalColor * directionalLightWeighting;
    }
  }
</script>

</script>

	
</head>

<body onload="webGLStart();">
	<!--<h1>Framsticks WEB GL</h1>
	<p>Wprowadź f0 aby narysować genotyp. Lewy przycisk myszy służy do obroty, prawy do przsuwania genotypu.</p>
-->	<textarea id="f0" style="display:none; visibility:hidden; "><? echo $_POST['genotyp']; ?></textarea><!--
	<input type="button" onclick="webGLStart(); " value="Parse" /><br />-->
	<canvas id="framstiks-canvas" style="border: none;" width="640" height="480"></canvas>
	<!--<div id="log"></div>-->
</body>
</html>
